<template>
   <div>
        <h1>增加专业</h1>
        <input type="text" v-model="subjects.name">
        <button @click="addSubjectsApi">新增专业</button>
   </div>
</template>

<script>
export default {
   data(){
      return{
         subjects:{
            name:''
         }
      }
   },
   methods:{
      async addSubjectsApi(){
         // const {code}=await this.$api.subjects.addSubjects(this.subjects)
         // console.log(code);
        //调用vuex中的actions中的addSubjectsAsync
        this.$store.dispatch('addSubjectsAsync',this.subjects)
      }
   }
}
</script>

<style>

</style>